#ifdef COMMONDATATYPES_CPP

#include "CommonDataTypes.h"

using namespace MarCore;
using namespace CDT;

//! Constructor
equation2df::equation2df( f32 powerx, f32 addx, f32 multiplyx )
{
    //values to add, multiply, and power up

    powerX = powerx;
    addX = addx;
    multiplyX = multiplyx;

    powerY = 1 / powerX;
    addY = addX * -1.f;
    multiplyY = 1 / multiplyX;

};

//! Internal PEMDAS solvers.

//! Solving with X for Y.
const float equation2df::addEqX ( float X_ )
{
    f32 x;
    x = X_ + addX;
    return x;
};

const float equation2df::multiplyEqX ( float X_ )
{
    f32 x;
    x = X_ * multiplyX;
    return x;
};

const float equation2df::powerEqX ( float X_ )
{
    f32 x;
    x = pow ( X_, powerX);
    return x;
};

//! Takes an X value, then solves and returns the Y.
const float equation2df::solveWithX( f32 X_ )
{
    f32 y;
    y = addEqX( multiplyEqX( powerEqX(X_) ) );
    return y;
};

//! Solving with Y for X.
const float equation2df::addEqY ( float Y_ )
{
    f32 y;
    y = Y_ + addY;
    return y;
};

const float equation2df::multiplyEqY ( float Y_ )
{
    f32 y;
    y = Y_ * multiplyY;
    return y;
};

const float equation2df::powerEqY ( float Y_ )
{
    f32 y;
    y = pow ( Y_, powerY);
    return y;
};

//! Takes an Y value, then solves and returns the X.
const float equation2df::solveWithY( f32 Y_ )
{
    f32 x;
    x = addEqY( multiplyEqY( powerEqY(Y_) ) );
    return x;
};

#endif // COMMONDATATYPES_CPP
